package com.zeta.eduservice.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zeta.eduservice.entity.EduTeacher;
import com.zeta.eduservice.entity.question.EduQuestion;
import com.zeta.eduservice.entity.question.EduQuestionChoice;
import com.zeta.eduservice.entity.vo.Ata;
import com.zeta.eduservice.entity.vo.QuestionChoiceVo;
import com.zeta.eduservice.entity.vo.front.ChoiceVo;
import com.zeta.eduservice.entity.vo.front.PdfQuestionVo;

/**
 * <p>
 * 选择试题 Mapper 接口
 * </p>
 *
 * @author zeta
 * @since 2020-10-08
 */
public interface EduQuestionChoiceMapper extends BaseMapper<EduQuestionChoice> {
		List<EduQuestionChoice> getByRandom(Integer difficulty,Integer number);
		List<EduQuestionChoice> getByRandomDetial(Integer difficulty,Integer number,String chapterid);
		Ata getinfo(String courseId);
		@Select("select b.*,a.id typeid from chapter_a_question_type_sys_and_choicequestion a join edu_question_choice b on a.question_id=b.id where a.is_deleted=0 and b.is_deleted=0 and a.regist_id=#{midid}")
		List<QuestionChoiceVo> getByMidId(Page<QuestionChoiceVo> page, @Param("midid")String midid);

		@Select("SELECT c.*,a.id typeid ,d.title chapter ,d.sort chaptersort FROM edu_chapter_and_question_type_sys a join chapter_a_question_type_sys_and_choicequestion b on a.id=b.regist_id join edu_question_choice c on c.id=b.question_id join edu_chapter d on d.id=a.chapter_id where a.course_id=#{courseid} and a.question_type_sys_id=#{typesys} and a.is_deleted=0 and b.is_deleted=0 and c.is_deleted=0  ")
		List<QuestionChoiceVo> getByCourseAndType(Page<QuestionChoiceVo> pageParam,@Param("courseid") String courseid,@Param("typesys") String typesys);

		@Select("select b.*,a.id typeid from paper_type_and_choicequestion a join edu_question_choice b on a.choicequestion_id=b.id where a.is_deleted=0 and b.is_deleted=0 and a.paper_type_id=#{midid}")
		List<QuestionChoiceVo> getByPaperTypeId(Page<QuestionChoiceVo> page, @Param("midid")String midid);
		@Select("select b.*,a.id typeid from paper_type_and_choicequestion a join edu_question_choice b on a.choicequestion_id=b.id where a.is_deleted=0 and b.is_deleted=0 and a.paper_type_id=#{midid}")
		List<QuestionChoiceVo> getByPaperTypeId(String typeId);

}
